<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@include file="/WEB-INF/jsp/include/tags.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>topic - list</title>
	<link rel="stylesheet" type="text/css" href="/css/style.css"/>
	<script type="text/javascript">
	<!--
		function goPage(page) {
			var f = document.topicCriteriaForm;
			f.action = '/topic.do';
			f.method = 'get';
			f.elements["mode"].value = "list";
			f.elements["paging.currentPage"].value = page;
			f.submit();
		}
		
		function search() {
			var f = document.topicCriteriaForm;
			f.action = '/topic.do';
			f.method = 'get';
			f.elements["mode"].value = "list";
			f.elements["paging.currentPage"].value = 0;
			f.submit();
		}
		
		function goDetail(topicId) {
			var f = document.topicCriteriaForm;
			f.action = '/topic.do';
			f.method = 'get';
			f.elements["mode"].value = "detail";
			f.elements["topicId"].value = topicId;
			f.submit();
		}
		
		function goWrite() {
			var f = document.topicCriteriaForm;
			f.action = '/topicWrite.do';
			f.method = 'get';
			f.elements["mode"].value = "write";
			f.submit();
		}
	//-->
	</script>
</head>
<body>
	
	<p><a href="/">home</a></p>
	
	<h1>Topic - list</h1>
	
	<form:form commandName="topicCriteria" id="topicCriteriaForm" name="topicCriteriaForm" action="/topic.do" method="get">
	<input type="hidden" name="mode"/>
	<form:hidden path="topicId"/>
	<form:hidden path="paging.currentPage"/>
	</form:form>
	
	<div>
		${topicCriteria.paging.totalResults} results. 
	</div>
	
	<table width="800">
		<colgroup width="800">
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
			<col width="*"/>
		</colgroup>
		<tr>
			<th>topicId</th>
			<th>channelId</th>
			<th>topicName</th>
			<th>shortName</th>
			<th>keywords</th>
			<th>description</th>
			<th>titleImg</th>
			<th>contentImg</th>
			<th>tplContent</th>
			<th>priority</th>
			<th>isRecommend</th>
		</tr>
		<c:forEach var="topic" items="${topicList}">
		<tr>
			<td>
				<a href="javascript:goDetail('${topic.topicId}');">
				<c:out value="${topic.topicId}"/>
				</a>
			</td>
			<td>
				<c:out value="${topic.channelId}"/>
			</td>
			<td>
				<c:out value="${topic.topicName}"/>
			</td>
			<td>
				<c:out value="${topic.shortName}"/>
			</td>
			<td>
				<c:out value="${topic.keywords}"/>
			</td>
			<td>
				<c:out value="${topic.description}"/>
			</td>
			<td>
				<c:out value="${topic.titleImg}"/>
			</td>
			<td>
				<c:out value="${topic.contentImg}"/>
			</td>
			<td>
				<c:out value="${topic.tplContent}"/>
			</td>
			<td>
				<c:out value="${topic.priority}"/>
			</td>
			<td>
				<c:out value="${topic.isRecommend}"/>
			</td>
		</tr>
		</c:forEach>
	</table>
	
	<div>
	<c:set var="paging" value="${topicCriteria.paging}"/>
	<%@ include file="/WEB-INF/jsp/include/paging/default.jsp"%>
	</div>
	
	<p/>
	
	<a href="<c:url value='javascript:goWrite();'/>">write</a>
	<a href="<c:url value='/topic.do'/>">list</a>

</body>
</html>
